package com.stark.wechat.service.material.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 获取图文素材响应
 *
 * @author <a href="mailto:mengbin@hotmail.com">Ben</a>
 * @version 1.0.0
 * @see <a href="https://developers.weixin.qq.com/doc/service/api/material/permanent/api_batchgetmaterial.html#_5-1-%E8%8E%B7%E5%8F%96%E5%9B%BE%E6%96%87%E7%B4%A0%E6%9D%90">素材管理 / 永久素材 / 获取永久素材列表</a>
 * @since 2024/5/26
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class BatchGetNewsMaterialResponsePayload implements Serializable {

    private static final long serialVersionUID = -2800002930207861129L;

    /**
     * 该类型的素材的总数
     */
    @JsonProperty("total_count")
    private int totalCount = 0;

    /**
     * 本次调用获取的素材的数量
     */
    @JsonProperty("item_count")
    private int itemCount = 0;

    /**
     * 素材列表
     */
    private List<NewsMaterialItem> item = new ArrayList<>();

    /**
     * 图文素材
     */
    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class NewsMaterialItem implements Serializable {

        private static final long serialVersionUID = -7478049049826120788L;

        /**
         * 媒体ID
         */
        @JsonProperty("media_id")
        private String mediaId;

        /**
         * 图文素材内容
         */
        private NewsMaterialContent content;

        /**
         * 更新日期
         */
        @JsonProperty("update_time")
        private Long updateTime;

        /**
         * 图文素材内容
         */
        @Data
        @JsonIgnoreProperties(ignoreUnknown = true)
        public static class NewsMaterialContent implements Serializable {

            private static final long serialVersionUID = -7329395508942390672L;

            /**
             * 图文素材列表
             */
            @JsonProperty("news_item")
            private List<NewsItem> newsItem = new ArrayList<>();

        }

    }

}
